#!/bin/sh

die () { echo "$@" ; exit 1; }

export NVM_DIR="$(cd ../../.. && pwd)"

: nvm.sh
\. "${NVM_DIR}/nvm.sh"

# Create an empty alias file
printf '' > ../../../alias/test-edge-empty
ACTUAL="$(nvm_alias test-edge-empty 2>/dev/null)"
EXIT_CODE="$(nvm_alias test-edge-empty 2>/dev/null; echo $?)"
[ -z "${ACTUAL}" ] || die "expected empty output for empty alias file, got >${ACTUAL}<"
[ "${EXIT_CODE}" = '0' ] || die "expected exit code 0, got ${EXIT_CODE}"

rm -f ../../../alias/test-edge-empty
